using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using static WaterCylinder.Input;
using static WaterCylinder.Mouse;

/// <summary>
/// 玩家控制器
/// </summary>

public class PlayerController
{   
    public Player player;
    public Vector2 GetMoveToward(){
        if(player == null){
            Debug.Log("PlayerControllerException: player is null");
            return default;
        }
        PlayerConfig cfg = GameManager.instance.playerConfig;
        if(cfg.moveModel == PlayerOperaModel.Keyboard){
            return GetOblique();
        }else if(cfg.moveModel == PlayerOperaModel.Mouse){
            Vector2 t = GetMousePosition2D() - (Vector2)player.transform.position;
            return t.normalized;
        }else{
            return default;
        }
    }
    public bool GetShotCheck(){
        if(player == null){
            Debug.Log("PlayerControllerException: player is null");
            return default;
        }
        PlayerConfig cfg = GameManager.instance.playerConfig;
        if(cfg.shot == "auto"){
            return true;
        }else{
            return Check(cfg.shot);
        }
    }
    public bool GetOtherCheck(string name){
        if(player == null){
            Debug.Log("PlayerControllerException: player is null");
            return default;
        }
        PlayerConfig cfg = GameManager.instance.playerConfig;
        switch(name){
            case "use":
                return Check(cfg.use);
            case "skill0":
                return Check(cfg.skill0);
            case "skill1":
                return Check(cfg.skill1);
            case "intercat":
                return Check(cfg.intercat);
            default:
                return false;
        }
    }
}
